UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JGk+shsjCcSlAMQ6LVH59sbdJbLVOQMZ2h4036mY2Oo=' 
WHERE 
  key_id = 'c5cd424a88d03c882f00a160e72cdd87f04d801cbac38ec80982f0c01e55ff90' 
  AND (
    token = 'JGk+shsjCcSlAMQ6LVH59sbdJbLVOQMZ2h4036mY2Oo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038