UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '27x+tU8Po/oEMQw8laL36ac+lpaOYGVpNPiyhjtkxGM=' 
WHERE 
  key_id = '4494c27a092a6932464d8d3e36f56dc183f8d6f9af7725152e5204ae3947429e' 
  AND (
    token = '27x+tU8Po/oEMQw8laL36ac+lpaOYGVpNPiyhjtkxGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039