UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gMgpDPdYXZXvlv/SeARVmj4YTwd3byl06ZnbgQwiSO4='
WHERE
key_id = 'b4ba57ec032264d9de90769121774a9bd11c3701c38bc07a9310c69384898102'
AND (
token = 'gMgpDPdYXZXvlv/SeARVmj4YTwd3byl06ZnbgQwiSO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)