UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PEQRMTADaHTH2rqQMF/mIJB+lUwu2X5N2q1GT8Oja7Y='
WHERE
key_id = 'e77a152769a39cd78f548cac9c2b4510f2889a5246dde6d83b67c480f90303a7'
AND (
token = 'PEQRMTADaHTH2rqQMF/mIJB+lUwu2X5N2q1GT8Oja7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)