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