UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IrOqvJj+nrgKE204YHkPj+EDZNStKFDw4mbkJSJ10g4=' 
WHERE 
  key_id = '8f50101c3e1d5a5398b230b9151f0d9a8d7a77375c74659ee09983d55996266c' 
  AND (
    token = 'IrOqvJj+nrgKE204YHkPj+EDZNStKFDw4mbkJSJ10g4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044