UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AjE4pQBVAnnwXJPq2gJ0PWqmOWBGMmhRxz88eU1FaAw='
WHERE
key_id = 'b7637f51e4a8f649a64949335b3c6cb4cb72ee5d3408a1812d828b42dd99da49'
AND (
token = 'AjE4pQBVAnnwXJPq2gJ0PWqmOWBGMmhRxz88eU1FaAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)