UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WESWOIaP3nAj38aouf9Yx3rk6BB6DyNER3UfYuIZ/UM='
WHERE
key_id = 'a0979867c926f1e506cc96efcd5d477f0da2fd4cbe9158a5fcdbc257b37599a7'
AND (
token = 'WESWOIaP3nAj38aouf9Yx3rk6BB6DyNER3UfYuIZ/UM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)