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