UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Su0Qrb9qGhInR4y1jFaChioEdlc/z6CnHlC9LN5pEHc=' 
WHERE 
  key_id = '02ade78a2a9313376ead63006fb1ef2d79fd7d6023138040a3e411371b8e7203' 
  AND (
    token = 'Su0Qrb9qGhInR4y1jFaChioEdlc/z6CnHlC9LN5pEHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037