UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EYl6q+rEBi9Z5k8vD5kyZGfl5EnR1adPyBhJlRBAabc='
WHERE
key_id = '8cfc54a86d19ff16ebdf1980bf634a7f80ab4ebfbdc1f2fdaa1d6511b693d370'
AND (
token = 'EYl6q+rEBi9Z5k8vD5kyZGfl5EnR1adPyBhJlRBAabc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)