UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mDJB7j2SOqU1ztrKKwczFhKJ6uyC1YvUSJslXkx+U3Y='
WHERE
key_id = '8bb6ad4b87e5034107c8d79b4f7245c23e1b4e6183e0594eeeb7301d6cdb9478'
AND (
token = 'mDJB7j2SOqU1ztrKKwczFhKJ6uyC1YvUSJslXkx+U3Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)