UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R9iiwj/NGy/jshCGx32kJPPXoY+k9wrZ4tHtXr2ERpE=' 
WHERE 
  key_id = '8f76b6fb6ee2964862a891b6c9335ce9c7d4868a4fe8ad63a1641a81f5013267' 
  AND (
    token = 'R9iiwj/NGy/jshCGx32kJPPXoY+k9wrZ4tHtXr2ERpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024