UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y8ZT8c2uxQP/KiQflzKw8p80otm9tzGdwtRqzbkLR+s='
WHERE
key_id = 'e0f6e0a5e4285c3ba375bc70feebcde1f60c0d52bdf3687e8be28d7d814e6f17'
AND (
token = 'y8ZT8c2uxQP/KiQflzKw8p80otm9tzGdwtRqzbkLR+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)