UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z9a90tFu+MhIrlEuyIutVxTbw85CVXZeX87QvbrGRj8='
WHERE
key_id = '7bf5aef38e46eaffd8d638dc9d607a480056aa70623fbb4487ab019a6f81afd4'
AND (
token = 'Z9a90tFu+MhIrlEuyIutVxTbw85CVXZeX87QvbrGRj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)