UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eCE1P0cvy6gm3qmXNfdztvmVB8qsNE52VDCU85Ug9Dc='
WHERE
key_id = '1b9ddc288c9c1056ed31c49a076c8afdcf249ed422f7f8cba30d0a908732a313'
AND (
token = 'eCE1P0cvy6gm3qmXNfdztvmVB8qsNE52VDCU85Ug9Dc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)