UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V8Z0TJzybCSL7dv4zna+dCA/4j4ZV8LEWFK013kOjW4=' 
WHERE 
  key_id = '7b6037e50097dc8311507ec1483a05ddf22be63ec376f2cc3de56f0e5ca62ff2' 
  AND (
    token = 'V8Z0TJzybCSL7dv4zna+dCA/4j4ZV8LEWFK013kOjW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023