UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z0AEIOZmRD0tgeH1Eh0A9CWPg+vIOJYtuPo00mkLQpw='
WHERE
key_id = 'ff4d27503986e295c08472e541e148e97149cb616788e63775b5114677150dbf'
AND (
token = 'z0AEIOZmRD0tgeH1Eh0A9CWPg+vIOJYtuPo00mkLQpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)