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