UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ld5lpEisFzD0JONiS/BQFE5S+vs5760ZEiMgJeM3Z9M='
WHERE
key_id = 'ecb5db33857f57ea6f14ff7bbc6294ef38f2ddd080dc2f35961192d8945d38a2'
AND (
token = 'ld5lpEisFzD0JONiS/BQFE5S+vs5760ZEiMgJeM3Z9M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)