UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pYcJddlfB0CmHwLngJetXpybPp+UmYzDPxNJpaGGAGA='
WHERE
key_id = 'd717014a328fdcf27fbfc31823b0ab9fefdc0e83a76f7d1d4ec43dca4cb9d955'
AND (
token = 'pYcJddlfB0CmHwLngJetXpybPp+UmYzDPxNJpaGGAGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)