UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OKE+/FtF576Z1e0VBlt3tdaEKaYhubRUxtO0M23EMj4='
WHERE
key_id = 'e7cd274b73f717543cb945d3e47181b58e21de36d0e790199dc9ad004c2d3d98'
AND (
token = 'OKE+/FtF576Z1e0VBlt3tdaEKaYhubRUxtO0M23EMj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)