UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cgFcBWU0mbGU3QUJS8RFtETpyjIJjgiV1Xc83uwJzpg=' 
WHERE 
  key_id = 'b83fb14d59b936d15f6e4e8fce396d1a7ccbe9840e2470788ec3ef454820715d' 
  AND (
    token = 'cgFcBWU0mbGU3QUJS8RFtETpyjIJjgiV1Xc83uwJzpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042