UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZM0RrhDWrGxtP3Vu2VMzGcp5WdQshaheI55buYjcuDY='
WHERE
key_id = '7b85bc9e1b5d00a55bb7948929c33d243f000615dad3565b099bd197286b6d39'
AND (
token = 'ZM0RrhDWrGxtP3Vu2VMzGcp5WdQshaheI55buYjcuDY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)