UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ppOrINEGU8QotguDRrhJ2JGfc1YjNHYxl2oxSe0KSNA='
WHERE
key_id = '6ea01c4fa8a1452b3474db4c5f71e208464450afde55e92a748685e266c9c081'
AND (
token = 'ppOrINEGU8QotguDRrhJ2JGfc1YjNHYxl2oxSe0KSNA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)