UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TprapPT853VQZyO4PKO1JF8RfYR6oaw1p43wRXtCzpA=' 
WHERE 
  key_id = '94862e5bda6853909c05f894bb496c6489a6089cf4aea798848042bf3e210de9' 
  AND (
    token = 'TprapPT853VQZyO4PKO1JF8RfYR6oaw1p43wRXtCzpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024