UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sXfTsxM8nTm5LCNMgfXQKo3UghSPf1PI/EG+1YbCnho='
WHERE
key_id = '831ee6a1bf5a79171780952940e107305cc8855b05b5cacd98330ce960da08a6'
AND (
token = 'sXfTsxM8nTm5LCNMgfXQKo3UghSPf1PI/EG+1YbCnho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)