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